<%
'v 4.2.2008
Sub SetApplication(aKey)
    prefixed = "OID" & aKey
    Application(aKey)=Request(prefixed)
    Response.Write "OID" & aKey & "=" & Server.URLEncode(Application(aKey)) & "&"
End Sub

Sub SetApplicationValue(aKey, aValue)
    prefixed = "OID" & aKey
    Application(aKey)=aValue
    Response.Write "OID" & aKey & "=" & aValue & "&"
End Sub

Sub OutputMode()
    Select Case Application(MODE)
        Case MODE_OFF
            Response.Write "OFF"
        Case MODE_HEAT
            Response.Write "<font color='red'>HEAT</font>"
        Case MODE_COOL
            Response.Write "<font color='blue'>COOL</font>"
        Case MODE_AUTO
            Response.Write "<font color='green'>AUTO</font>"
    End Select
End Sub

Sub OutputState()
    Select Case Application(STATE)
        Case STATE_INIT
            Response.Write "<font color='green'>INIT</font>"
        Case STATE_OFF
            Response.Write "OFF"
        Case STATE_HEAT
            Response.Write "<font color='red'>HEAT</font>"
        Case STATE_HEAT2
            Response.Write "<font color='maroon'>HEAT2</font>"
        Case STATE_HEAT3
            Response.Write "<font color='maroon'>AUX HEAT</font>"
        Case STATE_COOL
            Response.Write "<font color='blue'>COOL</font>"
        Case STATE_COOL2
            Response.Write "<font color='dark blue'>COOL 2</font>"
        Case STATE_DELAY
            Response.Write "<font color='pink'>DELAY</font>"
        Case STATE_RESETRELAYS
            Response.Write "<font color='orange'>RESET RELAYS</font>"
    End Select
End Sub

Sub OutputFan()
    Select Case Application(FAN)
        Case FAN_AUTO
            Response.Write "<font color='orange'>AUTO</font>"
        Case FAN_ON
            Response.Write "<font color='green'>ON</font>"
        Case FAN_SCHEDULE
            Response.Write "<font color='blue'>SCHEDULE</font>"
    End Select
End Sub

Sub OutputFanState()
    Select Case Application(FANSTATE)
        Case FANSTATE_INIT
            Response.Write "Init"
        Case FANSTATE_OFF
            Response.Write "<font color='red'>OFF</font>"
        Case FANSTATE_ON
            Response.Write "<font color='green'>ON</font>"
    End Select
End Sub

Sub OutputSetBackHeat()
    Response.Write Application(SETBACKHEAT)
End Sub

Sub OutputSetBackCool()
    Response.Write Application(SETBACKCOOL)
End Sub

Sub OutputSetBackHumidity()
    Response.Write Application(SETBACKHUMIDITY)
End Sub

Sub OutputSetBackStatus()
    Select Case Application(SETBACKSTATUS)
        Case SETBACKSTATUS_NORMAL
            Response.Write "Normal"
        Case SETBACKSTATUS_HOLD
            Response.Write "<font color='red'>Hold</font>"
        Case SETBACKSTATUS_OVERRIDE
            Response.Write "<font color='purple'>Override</font>"
    End Select
End Sub

Sub OutputCurrentPeriod()
    Select Case Application(CURRENTPERIOD)
        Case CURRENTPERIOD_MORN
            Response.Write "<font color='orange'>Morning</font>"
        Case CURRENTPERIOD_DAY
            Response.Write "<font color='red'>Day</font>"
        Case CURRENTPERIOD_EVE
            Response.Write "<font color='green'>Evening</font>"
        Case CURRENTPERIOD_NIGHT
            Response.Write "<font color='purple'>Night</font>"
    End Select
End Sub

Sub OutputCurrentClass()
    Select Case Application(CURRENTCLASS)
        Case CURRENTCLASS_IN
            Response.Write "<font color='red'>In</font>"
        Case CURRENTCLASS_OUT
            Response.Write "<font color='green'>Out</font>"
        Case CURRENTCLASS_AWAY
            Response.Write "<font color='purple'>Away</font>"
    End Select
End Sub

Sub OutputActivePeriod()
    Select Case Application(ACTIVEPERIOD)
        Case ACTIVEPERIOD_MORN
            Response.Write "<font color='orange'>Morning</font>"
        Case ACTIVEPERIOD_DAY
            Response.Write "<font color='red'>Day</font>"
        Case ACTIVEPERIOD_EVE
            Response.Write "<font color='green'>Evening</font>"
        Case ACTIVEPERIOD_NIGHT
            Response.Write "<font color='purple'>Night</font>"
        Case ACTIVEPERIOD_HOLD
            Response.Write "<font color='pink'>Hold</font>"
        Case ACTIVEPERIOD_OVERRIDE
            Response.Write "<font color='maroon'>Override</font>"
    End Select
End Sub

Sub OutputSensor1Name()
    Response.Write Application(SENSOR_NAME_1)
End Sub

Sub OutputSensor2Name()
    Response.Write Application(SENSOR_NAME_2)
End Sub

Sub OutputSensorStateLocal()
    Select Case Application(SENSOR_STATE_LOCAL)
        Case SENSOR_NOTPRESENT
            Response.Write "<font color='orange'>Not Present</font>"
        Case SENSOR_DISABLED
            Response.Write "<font color='red'>Disabled</font>"
        Case SENSOR_ENABLED
            Response.Write "<font color='green'>Enabled</font>"
    End Select
End Sub

Sub OutputSensorState1()
    Select Case Application(SENSOR_STATE_1)
        Case SENSOR_NOTPRESENT
            Response.Write "<font color='orange'>Not Present</font>"
        Case SENSOR_DISABLED
            Response.Write "<font color='red'>Disabled</font>"
        Case SENSOR_ENABLED
            Response.Write "<font color='green'>Enabled</font>"
    End Select
End Sub

Sub OutputSensorState2()
    Select Case Application(SENSOR_STATE_2)
        Case SENSOR_NOTPRESENT
            Response.Write "<font color='orange'>Not Present</font>"
        Case SENSOR_DISABLED
            Response.Write "<font color='red'>Disabled</font>"
        Case SENSOR_ENABLED
            Response.Write "<font color='green'>Enabled</font>"
    End Select
End Sub

Sub OutputIncludeLocalInAverage()
    Select Case Application(SENSOR_AVERAGE_LOCAL)
        Case SENSOR_AVERAGE_DISABLED
            Response.Write "<font color='red'>Disabled</font>"
        Case SENSOR_AVERAGE_ENABLED
            Response.Write "<font color='green'>Enabled</font>"
    End Select
End Sub

Sub OutputIncludeSensor1InAverage()
    Select Case Application(SENSOR_AVERAGE_1)
        Case SENSOR_AVERAGE_DISABLED
            Response.Write "<font color='red'>Disabled</font>"
        Case SENSOR_AVERAGE_ENABLED
            Response.Write "<font color='green'>Enabled</font>"
    End Select
End Sub

Sub OutputIncludeSensor2InAverage()
    Select Case Application(SENSOR_AVERAGE_2)
        Case SENSOR_AVERAGE_DISABLED
            Response.Write "<font color='red'>Disabled</font>"
        Case SENSOR_AVERAGE_ENABLED
            Response.Write "<font color='green'>Enabled</font>"
    End Select
End Sub


Sub OutputSensor1Type()
    Select Case Application(SENSOR_TYPE_1)
        Case ANALOG_SENSOR
            Response.Write "<font color='red'>Analog</font>"
        Case THERMISTOR_SENSOR
            Response.Write "<font color='green'>Thermistor</font>"
    End Select
End Sub

Sub OutputSensor2Type()
    Select Case Application(SENSOR_TYPE_2)
        Case ANALOG_SENSOR
            Response.Write "<font color='red'>Analog</font>"
        Case THERMISTOR_SENSOR
            Response.Write "<font color='green'>Thermistor</font>"
    End Select
End Sub


Sub OutputAverageTemp()
    Response.Write Application(AVERGAE_TEMP)
End Sub

Sub OutputLocalTemp()
    Response.Write Application(SENSOR_TEMP_LOCAL)
End Sub

Sub OutputSensor1Temp()
    Response.Write Application(SENSOR_TEMP_1)
End Sub

Sub OutputSensor2Temp()
    Response.Write Application(SENSOR_TEMP_2)
End Sub


Sub OutputRelativeHumidity()
    Response.Write Application(RELATIVE_HUMIDITY)
End Sub

Sub OutputSystemUptime()
    Response.Write GetUptime()
End Sub

Sub OutputTime()
    Response.Write GetTime()
End Sub

Sub OutputDeviceName()
    Response.Write Application(DEVICE_NAME)
End Sub

Sub OutputModelNumber()
    Response.Write Application(MODEL_NUMBER)
End Sub
%>